<template>
  <Form ref="form" :model="formData" :rules="ruleValidate" :label-width="80">
    <input type="hidden" v-model="formData.id" />
    <Row>
      <Col span="12">
        <FormItem label="车次" prop="number">
          <Input v-model="formData.number"></Input>
        </FormItem>
      </Col>
      <Col span="12">
        <FormItem label="类型" prop="type">
          <Input v-model="formData.type"></Input>
        </FormItem>
      </Col>
    </Row>
    <Row>
      <Col span="12">
        <FormItem label="车厢数" prop="carriageCount">
          <Input v-model="formData.carriageCount"></Input>
        </FormItem>
      </Col>
      <Col span="12">
        <FormItem label="运行时长" prop="duration">
          <Input v-model="formData.duration"></Input>
        </FormItem>
      </Col>
    </Row>
    <Row>
      <Col span="12">
        <FormItem label="始发站" prop="startStation">
          <Input v-model="formData.startStation"></Input>
        </FormItem>
      </Col>
      <Col span="12">
        <FormItem label="终点站" prop="endStation">
          <Input v-model="formData.endStation"></Input>
        </FormItem>
      </Col>
    </Row>
    <Row>
      <Col span="12">
        <FormItem label="始发时间" prop="startTime">
          <Input v-model="formData.startTime"></Input>
        </FormItem>
      </Col>
      <Col span="12">
        <FormItem label="终到时间" prop="endTime">
          <Input v-model="formData.endTime"></Input>
        </FormItem>
      </Col>
    </Row>
    <Row>
      <Col span="12">
        <FormItem label="到达类型" prop="arriveType">
          <Input v-model="formData.arriveType"></Input>
        </FormItem>
      </Col>
      <Col span="12">
        <FormItem label="运行类型" prop="runType">
          <Input v-model="formData.runType"></Input>
        </FormItem>
      </Col>
    </Row>

    <FormItem>
      <Button type="primary" @click="handleSubmit('form')">保存</Button>
      <Button type="primary" @click="go2list()" style="margin-left: 8px"
        >关闭</Button
      >
    </FormItem>
  </Form>
</template>

<script>
import { baseEdit } from "@/libs/crud/base-edit";

export default {
  mixins: [baseEdit],
  data() {
    return {
      formData: {
        id: "",
        number: "",
        type: "",
        startStation: "",
        endStation: "",
        startTime: "",
        endTime: "",
        arriveType: "",
        runType: "",
        duration: "",
      },
      ruleValidate: {
        number: [
          { required: true, message: "车次不能为空", trigger: "blur" },
        ],
      },
    };
  },
};
</script>
